package com.education.welco.controller.app;


import com.education.common.core.BaseController;
import com.education.common.utils.ApiReturnObject;
import com.education.welco.pojo.LPaper;
import com.education.welco.service.ILPaperService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 试卷 信息操作处理
 *
 * @author d
 * @date 2020-05-08
 */
@Api(tags = {"平台课程--模拟测试-试卷"})
@RestController
@RequestMapping("/app/lPaper")
public class AppLPaperController extends BaseController {

    @Autowired
    private ILPaperService ilPaperService;


    @ApiOperation(value = "平台课程--试卷接口", httpMethod = "GET")
    @GetMapping("/findByPaper")
    public ApiReturnObject findByPaper(Integer catalogId) {
        if (catalogId == null){
            return new ApiReturnObject("200", "catalog不存在", "catalog不存在");
        }else {
            LPaper lPaper = new LPaper();
            lPaper.setCatalogId(catalogId);
            List<LPaper> lPaperList = ilPaperService.selectLPaperList(lPaper);
            return new ApiReturnObject("200", "查询成功", lPaperList.size(),lPaperList);
        }
    }

}